<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
    
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
<link href="../css/bootstrap.css" rel="stylesheet" type="text/css" media="all" />
<link href="../css/snow.css" rel="stylesheet" type="text/css" media="all" />
<link href="../css/component.css" rel="stylesheet" type="text/css" media="all" />
<link href="../css/style_grid.css" rel="stylesheet" type="text/css" media="all" />
<link href="../css/style.css" rel="stylesheet" type="text/css" media="all" />
<!-- font-awesome-icons -->
<link href="../css/font-awesome.css" rel="stylesheet"> 
<!-- //font-awesome-icons -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800" rel="stylesheet">
</head>
<body>
			<!-- /pages_agile_info_w3l -->

						<div class="pages_agile_info_w3l">
							<!-- /login -->
							   <div class="over_lay_agile_pages_w3ls two">
								<div class="registration">
								
												<div class="signin-form profile">
													<h2>Sign up Form</h2>
													<div class="login-form">
														<form action="<%=basePath%>puser/register" method="post" onsubmit="return userExist();">
																
																<input type="text" name="name" placeholder="Username" required="">
																<input type="text" name="phone" id="phone" placeholder="phone" required="">

																<input type="password" name="password" id="password" placeholder="Password" required="">
																<input type="password" id="password2" placeholder="Confirm Password" required="">
							
															<div class="tp">
																<input type="submit" value="SIGN Up">
															</div>
														</form>
													</div>
													
													<p><a href="#"> By clicking Sign Up, I agree to your terms</a></p>
													
													 <h6><a href="main-page.html">Back To Home</a><h6>
												</div>
										</div>
										<!--copy rights start here-->
											<div class="copyrights_agile two">
												 <p>Copyright &copy; 2017.Company name All rights reserved.</p>
											</div>	
											<!--copy rights end here-->
						    </div>
						</div>
							<!-- /login -->
<!-- //pages_agile_info_w3l -->


<!-- js -->

          
		  <script src="../js/modernizr.custom.js"></script>
		
		   <script src="../js/classie.js"></script>
		  <script src="../js/gnmenu.js"></script>
		  
	
<!-- //js -->

<script src="../js/screenfull.js"></script>
		<script>
		
		</script>
<script src="../js/jquery.nicescroll.js"></script>
<script src="../js/scripts.js"></script>


<script type="text/javascript" src="../js/bootstrap-3.1.1.min.js"></script>
<script src="../js/jquery.min.js"></script>
<script>
function userExist(){
	debugger;
	var password = document.getElementById("password").value;
	var password2 = document.getElementById("password2").value;
	if(password!=password2){
		alert("两次输入的密码不一致！！");
		return false;
	}
	
	var phone=document.getElementById("phone").value;
	var result = 0; 
	
	$.ajax( {
		url:'<%=basePath %>puser/userExist',
			async: false,
			type : 'post',
			data : {
				phone : phone
			},
			datatype : "text",//"xml", "html", "script", "json", "jsonp", "text".           
			success : function(data) {

				if (data!=200) {
					alert("该账号已存在！");
					result=1;
					
				} 

			},
			error : function() {
				alert("异常！");
			}
		});
	if(result!=1){
		
		return true;
	}else{
		
		return false;
	}
	
	
}
</script>


</body>
</html>